<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

</body>


<script type="text/javascript">
  /**
   * @return {[]}
   * @param a
   * @param b
   */
  let threeSum = function (nums) {
    let sums = [];
    let a = 0;
    for (let i = 0; i < nums.length; i++) {
      for (let j = i; j < nums.length; j++) {
        if (nums[i] + nums[j - 1] + nums[j] === 0) {
          sums[a] = [nums[i], nums[j - 1], nums[j]];
          if (!fun(sums[a], [nums[i], nums[j - 1], nums[j]])) {
            i++;
            j++;
          }
          a++;
        }
      }
    }
    function fun(a, b) {
      let c = 0;
      for (let i = 0; i < a.length; i++) {
        for (let j = 0; j < b.length; j++) {
          if (a[i] === b[j]) {
            c++;
            break;
          }
        }
      }
      return c < 3;
    }
    console.log(sums);
    return sums;
  };

  let nums = [0,0,0,0];
  threeSum(nums);





</script>
</html>